package com.tuanzi.loan.business.service.sms.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tuanzi.loan.business.entity.sms.PhoneLocation;
import com.tuanzi.loan.business.repository.sms.PhoneLocationRepository;
import com.tuanzi.loan.business.service.sms.PhoneLocationService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.service.CommonServiceImpl;

import lombok.extern.slf4j.Slf4j;

/**
* @author chenweijun 
* @version 2018年7月25日
*/
@Debug
@Slf4j
@Service
@Transactional
public class PhoneLocationServiceImpl extends CommonServiceImpl<PhoneLocation, Long> implements PhoneLocationService{
	
	@Autowired
	private PhoneLocationRepository phoneLocationRepository;
	
	@Override
	protected JpaRepository<PhoneLocation, Long> getRepository() {
		return phoneLocationRepository;
	}

	@Override
	public Map<String, String> findDistinctProvince() {
		List<String> provinces = phoneLocationRepository.findDistinctProvince();
		Map<String, String> provincesMap = new HashMap<>();
		for(String province: provinces) {
			provincesMap.put(province, province);
		}
		return provincesMap;
	}
	

}
